package com.ruoyi.web.controller;


import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.ContactUsSection;
import com.ruoyi.system.service.IContactUsSectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author linxz
 * @since 2025-01-07
 */
@RestController
@RequestMapping("/contactUsSection")
public class ContactUsSectionController extends BaseController {
    @Autowired
    private IContactUsSectionService service;

    @GetMapping("/list")
    public AjaxResult getList(){
        return AjaxResult.success(service.getList());
    }
    @PostMapping("/add")
    public AjaxResult add(@RequestBody ContactUsSection section){
        if(service.add(section)>0){
            return AjaxResult.success();
        }else {
            return AjaxResult.error("模块名称不能重复");
        }
    }

    @PostMapping("/update")
    public AjaxResult update(@RequestBody ContactUsSection section){
        return toAjax(service.update(section));
    }
    @PostMapping("/delete")
    public AjaxResult delete(@RequestBody ContactUsSection section){
        return toAjax(service.delete(section.getId()));
    }

}
